//
//  HeadView.m
//  PTravel
//
//  Created by dllo on 15/11/14.
//  Copyright © 2015年 李涵. All rights reserved.
//

#import "HeadView.h"

@implementation HeadView

- (void)dealloc
{
    [_aView release];
    [_bView release];
    [_bookImage release];
    [_bookLabel release];
    [_dicountLabel release];
    [_discountImage release];
    [_hotelImage release];
    [_hotelLabel release];
    [_travelImage release];
    [_travelLabel release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        [self createSubViews];
    }
    return self;
}


- (void)createSubViews
{
    
    self.bView = [[UIView alloc] initWithFrame:CGRectMake(0, 190*HEGIHT, BOUNDS.size.width, 90*HEGIHT)];
    [self addSubview:self.bView];
    

    self.discountImage = [[UIImageView alloc] initWithFrame:CGRectMake(self.bookImage.frame.origin.x+60*WIDTH, 22*HEGIHT, 70*WIDTH, 70*HEGIHT)];
    self.discountImage.image = [UIImage imageNamed:@"iconfont-h5zhekou-2.png"];
    self.discountImage.userInteractionEnabled = YES;
    UITapGestureRecognizer *discountTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(discountAction)];
    [self.discountImage addGestureRecognizer:discountTap];
    [self.bView addSubview:self.discountImage];
    [_discountImage release];
    [discountTap release];
    

    
    self.travelImage = [[UIImageView alloc] initWithFrame:CGRectMake(self.discountImage.frame.origin.x+160*HEGIHT, 19*HEGIHT, 78*WIDTH, 78*HEGIHT)];
    self.travelImage.image = [UIImage imageNamed:@"iconfont-cj.png"];
    self.travelImage.userInteractionEnabled = YES;
    UITapGestureRecognizer *travelTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(travelAction)];
    [self.travelImage addGestureRecognizer:travelTap];
    [self.bView addSubview:self.travelImage];
    [_travelImage release];
    [travelTap release];
    

    self.dicountLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.discountImage.frame.origin.x + 80*HEGIHT, self.discountImage.frame.origin.y, 30*WIDTH, 80*HEGIHT)];
    self.dicountLabel.text = @"抢折扣";
    self.dicountLabel.textColor = [UIColor colorWithRed:61.57 green:-64.67 blue:56.72 alpha:0.8];
    self.dicountLabel.font = [UIFont systemFontOfSize:20];
    self.dicountLabel.numberOfLines = 3;
    [self.bView addSubview:self.dicountLabel];
    [_dicountLabel release];
    

    
    self.travelLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.travelImage.frame.origin.x + 80*WIDTH, self.discountImage.frame.origin.y, 30*WIDTH, 80*HEGIHT)];
    self.travelLabel.text = @"旅途中";
    self.travelLabel.font = [UIFont systemFontOfSize:20];
    self.travelLabel.textColor = [UIColor orangeColor];
    self.travelLabel.numberOfLines = 3;
    [self.bView addSubview:self.travelLabel];
    [_travelLabel release];
}

//#pragma mark ** 看锦囊
//- (void)bookAction
//{
//    [self.headViewDelegate lookBook];
//    
//}


#pragma mark ** 抢折扣
- (void)discountAction
{
    
    [self.headViewDelegate discount];
}
//#pragma mark ** 订酒店
//- (void)hotelAction
//{
//    NSLog(@"ahsdkfjhasjkd");
//    
//}
#pragma mark ** 旅途中
- (void)travelAction
{   [self.headViewDelegate traveling];
    NSLog(@"ahsdkfjhasjkd");
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
